<script lang="ts" setup name="XtxCheckbox">
defineProps<{
  modelValue: boolean
}>()
const emit = defineEmits<{
  (e: 'updata:modelValue',value: boolean): void
}>()
</script>

<template>
  <div class="xtx-checkbox">
    <i v-if="modelValue" @click="emit('updata:modelValue',!modelValue)" class="iconfont icon-checked"></i>
    <i v-else class="iconfont icon-unchecked"></i>
    <span>提示文本</span>
  </div>
</template>

<style scoped lang="less">
.xtx-checkbox {
  display: inline-block;
  margin-right: 2px;
  .icon-checked {
    color: @xtxColor;
    ~ span {
      color: @xtxColor;
    }
  }
  i {
    position: relative;
    top: 1px;
  }
  span {
    margin-left: 2px;
  }
}
</style>
